import java.util.Vector;

public class Rubrica {

	private String nome;
	protected Vector<String> rubrica = new Vector<String>();
	public int THIS_DIM;

	public Rubrica(String nome, int dim) {
		this.nome = nome;
		THIS_DIM = dim;
	}


	public boolean aggiungi(String nome, String email, Vector<String> num) {
		Rubrica i = new Rubrica(nome, email, num);
		array.add(i);
	}

	public Vector<String> cerca(String s) {
		Vector<String> trovati = new Vector<String>();
		for (String s1 : rubrica) {
			if (s1.toLowerCase().startsWith(s.toLowerCase())) {
				trovati.add(s1);
			}
		}
		return trovati;
	}
	
	public Vector<String> cercaCaseSensitive(String s) {
		Vector<String> trovati = new Vector<String>();
		for (String s1 : rubrica) {
			if (s1.startsWith(s.toLowerCase())) {
				trovati.add(s1);
			}
		}
		return trovati;
	}
	public Vector<String> cercaSubstr(String s) {
		Vector<String> trovati = new Vector<String>();
		for (String s1 : rubrica) {
			if (s1.toLowerCase().contains(s.toLowerCase())) {
				trovati.add(s1);
			}
		}
		return trovati;
	}
	
	public void rimuovi(Vector<String> strings) {
		for (String s : strings) {
			rubrica.remove(s);
		}
	}

	public String getNome() {
		return nome;
	}
	
	public int getMaxDim() {
		return THIS_DIM;
	}

	public int getDim() {
		return rubrica.size();
	}

	public String toString() {
		String st = "";
		for (String s : rubrica) {
			st = st + "\n" + s;
		}
		return st;
	}

}
